<template>
  <div class="data-panel">
    <div class="panel-header">
      <span class="panel-title">{{ title }}</span>
    </div>
    <div class="panel-body">
      <div v-if="isLoading" class="loading-indicator">
        <div class="spinner"></div>
        <span>数据加载中...</span>
      </div>
      <slot v-else></slot>
    </div>
  </div>
</template>

<script setup>
import { defineProps } from 'vue';

defineProps({
  title: {
    type: String,
    required: true,
  },
  isLoading: {
    type: Boolean,
    default: false,
  },
});
</script>

<style scoped>
@keyframes rotate {
  100% {
    transform: rotate(360deg);
  }
}

@keyframes glow {
  0%, 100% {
    border-image-source: linear-gradient(135deg, #00e5ff, #005c9e, #00e5ff);
  }
  50% {
    border-image-source: linear-gradient(135deg, #005c9e, #00e5ff, #005c9e);
  }
}

.data-panel {
  position: relative;
  background-color: rgba(0, 21, 53, 0.6);
  background-image: 
    linear-gradient(rgba(0, 162, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 162, 255, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  
  border: 2px solid;
  border-image-slice: 1;
  border-image-source: linear-gradient(135deg, #00e5ff, #005c9e);
  animation: glow 4s linear infinite;
}

.panel-header {
  height: 40px;
  line-height: 40px;
  padding: 0 15px;
  font-size: 18px;
  font-weight: bold;
  color: #00e5ff;
  text-shadow: 0 0 5px #00e5ff;
  background: linear-gradient(to right, rgba(0, 162, 255, 0.2), transparent);
  border-bottom: 1px solid rgba(0, 162, 255, 0.3);
}

.panel-body {
  flex-grow: 1;
  padding: 15px;
  position: relative;
}

.loading-indicator {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  color: #aed4ff;
  font-size: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid rgba(0, 229, 255, 0.2);
  border-top-color: #00e5ff;
  animation: rotate 1s linear infinite;
  margin-bottom: 15px;
}
</style> 